<template>
	<view class="wanl-money">
		<view class="bg-orange padding-bj">
			<text class="title">养老金</text>
			<view class="margin-top margin-bottom-xs">
				<text class="text-sl">可转入：{{dingjin.kzrylj}}</text><br>
				<text class="text-sl">已转入：{{dingjin.yzrylj}}</text><br>
				<text class="text-sl">已同步：{{dingjin.yitongbu}}</text>
			</view>
		</view>
		
		<view class="cu-list menu sm-border">
			<view class="cu-item arrow" @tap="$wanlshop.to('/pages/user/money/zhuanyanglaojin')">
				<view class="content">
					<text class="wlIcon-yinhangka text-blue"></text>
					<text>提现到中信养老金账户</text>
				</view>
				<!-- <view class="action">
					<text class="text-sm wanl-gray">用于养老金提现</text>
				</view> -->
			</view>
			<view class="cu-item arrow" @tap="$wanlshop.to('/pages/user/money/yanglaojinlog')">
				<view class="content">
					<text class="wlIcon-yue1 text-orange"></text>
					<text>明细</text>
				</view>
			</view>
			
		</view>
		<!-- 功能 -->
		<view class="cu-list menu sm-border">
				<view class="cu-item arrow">
					<!-- <view class="content">
						<text class="wlIcon-chongzhichenggong text-blue"></text>
						
					</view> -->
					<!-- 给最外面的盒子定义你需要的宽高 相对定位 -->
					<view style="width: 100%; height: 40px; position: relative;">
						<!-- 你自己的样式，可以添加图片和其他样式，只要绝对定位到位置就好了 -->
						<view style="width: 100%; height: 40px;position: absolute;top:0px;left: 0px;line-height: 40px;"><text class="wlIcon-chongzhichenggong text-blue"></text><text style="margin-left:20rpx">中信公证处查看</text></view>
						<!-- 给标签里的内容都绝对定位，宽高100% -->
						<!-- 不放心可以设置层级z-index:;需要调试的话可以在style里面添加背景颜色background: 'red'; opacity: 0.3;-->
						<wx-open-launch-weapp id="launch-btn" appid="wx94146ca06604871d" path="/pages/con_home/con_home"
							style="position: absolute; top: 0; left: 0; width: 100%; height:100% ; opacity: 0;">
							<script type="text/wxtag-template">
								<style></style>
												<view style="position: absolute;top: 0; left: 0; width: 100%;height: 100% ; opacity: 0;">
												</view>
										    </script>
						</wx-open-launch-weapp>
					</view>
				</view>
			<view class="cu-item arrow" @tap="$wanlshop.to('/pages/user/money/yanglaoguizhe')">
				<view class="content">
					<text class="wlIcon-yue1 text-orange"></text>
					<text>查看养老金规则</text>
				</view>
			</view>
		
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import wx from 'weixin-js-sdk'
	export default {
		data() {
			return {
				dingjin: 0
			};
		},
		computed: {
			...mapState(['user'])
		},
		onLoad() {
			this.loadData();
		},
		methods: {
			async loadData() {
				this.$api.post({
					url: '/wanlshop/pay/getyanglaojin',
					success: res => {
						this.$store.commit('user/setUserInfo', {
							dingjin: res
						});
						this.dingjin = res
					}
				});
				this.$api.post({
					url: '/wanlshop/pay/getjassdk',
					success: res => {
						console.log(res)
						wx.config({
								debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
								appId: res.appId, // 必填，企业号的唯一标识，此处填写企业号corpid
								timestamp: res.timestamp, // 必填，生成签名的时间戳
								nonceStr: res.nonceStr, // 必填，生成签名的随机串
								signature: res.signature, // 必填，签名
								jsApiList: ['wx-open-launch-weapp'], // 必填，需要使用的JS接口列表
								openTagList: ['wx-open-launch-weapp']
							}),
							wx.ready(() => {
								console.log('成功')
							});
							wx.error(function(res1) {
								console.log('出错', res1, res1.errMsg)
							});
					}
				});

			}
		}
	};
</script>

<style>
	.wanl-money .title {
		color: rgba(255, 255, 255, .7);
	}

	.text-sl {
		font-size: 32rpx;
	}
</style>